<?php
/**
 * Created by PhpStorm.
 * User: User
 * Date: 2017/10/9
 * Time: 18:30
 */

class Circle
{
    private $r;

    public function __construct($r)
    {
        $this->r=$r;
    }

    public function __clone()
    {
        $this->r=10;
        // TODO: Implement __clone() method.
    }
    public  function __toString()
    {
        return 'circle.r=' . $this->r;
    }
    public function __call($methodanme, $arguments)
    {
        die("你调用的方法".$methodanme."不存在");
  // TODO: Implement __call() method.
    }
    public  function  getArea(){

    }
    public function __sleep()
    {
        return array("r");
        // TODO: Implement __sleep() method.
    }
    public function __wakeup()
    {

        // TODO: Implement __wakeup() method.
    }

}



/*
    public static function getPi(){
        return 3.14;
    }

    public  function  getArea(){
        return 3.14*$this->r*$this->r;
    }

    public function __set($name, $value)
    {   if ($name=='r' && $value<0){
        $this->r=0;
    }else
    {
        $this->$name=$value;
    }
    }
    public function __get($name)
    {
        if ($name=='r'){
            return$this->radus;
        }else{
            return $this->$name;
        }

    }
}
*/

$c=new Circle(3);
$e=$c;
$str=serialize($c);
echo $c;
$d=unserialize($str);
echo "<br/>";
var_dump($d);

//$e=$c->getArea2();
/*
$d=$c;
$cc=clone $c;
var_dump($c);
var_dump($d);
var_dump($c);